//
//  mainButton.m
//  movie
//
//  Created by 李丹阳 on 15/7/17.
//  Copyright (c) 2015年 李丹阳. All rights reserved.
//

#import "mainButton.h"

@implementation mainButton


- (id)initWithFrame:(CGRect)frame WithBackImage:(NSString *)image WithTitle:(NSString *)title{
    self = [super initWithFrame:frame];
    if (self) {
    
        _bgimge = [[UIImageView alloc]initWithFrame:CGRectZero];
        _bgimge.image = [UIImage imageNamed:image];
        [self addSubview:_bgimge];
        _bgimge.contentMode = UIViewContentModeScaleAspectFit;
        
        _label = [[UILabel alloc]initWithFrame:CGRectZero];
        _label.text = title;
        _label.textColor = [UIColor whiteColor];
        _label.textAlignment = NSTextAlignmentCenter;
        _label.font = [UIFont systemFontOfSize:11];
        [self addSubview:_label];
    }
    return self;
}

- (void)layoutSubviews{
//    CGFloat high =  self.frame.size.height;
    CGFloat wide = self.frame.size.width;
    _bgimge.frame = CGRectMake((wide/2)-10, 5, 20, 20);

    _label.frame = CGRectMake(23, CGRectGetMaxY(self.bgimge.frame), 30, 20);
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
